<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
 <head>
<title>个人派工明细报表</title>
<%@ include file="/common/meta.jsp" %>
<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
<script type="text/javascript">
var basic_Url="${ctx}/logic/Reports";
var basic_WUrl="/logic/Reports";
var grid;
//获得表数据
$(function(){
	grid=$("#table1").ligerGrid({
			columns: [
			          { display: 'PI单号', name: 'zd003PiCode', width: 100 },
			          { display: '派工料单号', name: 'zd001FormCode', width: 100 },
			          { display: '客户名称', name: 'customerName', width: 100 },
			          { display: '产品编码', name: 'zd006MaterialsCode', width: 100 },
			          { display: '产品名称', name: 'zd006MaterialsName', width: 100 },
			          { display: '型号', name: 'zd010MaterialsModel', width: 100 },
			          { display: '尺寸', name: 'zd023MaterialsSize', width: 100 },
			          { display: '颜色', name: 'zd026MaterialsColor', width: 100 },
			          { display: '材质', name: 'zd027MaterialsQuality', width: 100 },
			          { display: '员工姓名', name: 'zd008UseName', width: 100 },
			          { display: '工序', name: 'zd029ProcessName', width: 100 },
			          { display: '车间', name: 'zd028WorkShopName', width: 100 },
			          { display: '派工数目', name: 'zdTheQuantity', width: 100,render:function (item){
			        	  if(item.zdTheQuantity==null||item.zdTheQuantity==""||parseFloat(item.zdTheQuantity)==0){
			        		  return '0.0';
			        	  }
			        	  return item.zdTheQuantity;
			          } },
			          { display: '工序单价', name: 'zd014Price', width: 100 ,render:function (item){
			        	  if(item.zd014Price==null||item.zd014Price==""||parseFloat(item.zd014Price)==0){
			        		  return '0.0';
			        	  }
			        	  return item.zd014Price;
			          } },
			          { display: '总价', name: 'allprice', width: 100,render:function (item){
			        	  if(item.allprice==null||item.allprice==""||parseFloat(item.allprice)==0){
			        		  return '0.0';
			        	  }
			        	  return item.allprice;
			          } },
			          { display: '派工时间', name: 'bizCreatorDate', width: 100 ,  render: function (item){
			        	  return formatDate(new Date(item.bizCreatorDate),"yyyy-MM-dd");
			          }},
			          { display: '日报时间', name: 'zd008WorkDate', width: 100 ,  render: function (item){
			        	  if(item.zd008WorkDate==""||item.zd008WorkDate==null){
			        		  return '暂未生成日报';
			        	  }
			        	  return item.zd008WorkDate;
			          }}
			          ],
		              url : basic_Url+"/dispatchingDetailsListItem.do?condition="+$("#condition").val()+"&usercode="+$("#usercode").val()+"&workshop="+$("#workshop").val()+"&_search=true",
		              usePager: false,
		              width: "100%", height:'90%', checkbox: true, rownumbers:true,
		              onSelectRow : function(item){
		            	  var data=grid.getSelectedRows();
		            		var sum=0;
		            		var sumNum=0;
		            		 $(data).each(function(){
		            			sum=sum+this.allprice;
		            			sumNum=sumNum+this.zdTheQuantity;
		            		 });
		            		 sum=sum.toFixed(4);
		            		 sumNum=sumNum.toFixed(4);
		            		 $("#sumPice").val(sum);
		            		 $("#sumNum").val(sumNum);
		              },
		              onUnSelectRow : function(item){
		            	  var data=grid.getSelectedRows();
		            		var sum=0;
		            		var sumNum=0;
		            		 $(data).each(function(){
		            			sum=sum+this.allprice;
		            			sumNum=sumNum+this.zdTheQuantity;
		            		 });
		            		 sum=sum.toFixed(4);
		            		 sumNum=sumNum.toFixed(4);
		            		 $("#sumPice").val(sum);
		            		 $("#sumNum").val(sumNum);
		              }
	                  });
		$("#pageloading").hide();
	
});
</script>

</head>

<body style="padding:10px" >
<div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
			            	 <li>共计数量：</li>
							 <li><input type="text" readonly="readonly" id='sumNum' /> </li>
				             <li>共计金额：</li>
							<li><input type="text" readonly="readonly" id='sumPice' /> </li>
			             </ul>
	                </div>
               </div>
          </div>
		<input  type="hidden" id='condition' value='${condition}'/>
		<input  type="hidden" id='usercode' value='${usercode}'/>
		<input  type="hidden" id='workshop' value='${workshop}'/>
      <div position="center" id="table1">
      </div>
      <div class="subBar">
      <div class="clear"></div>
</body>
</html>